export default (url) => {
  const crud = window.$crud(url);

  const updateState = (id, state) =>
    window.$axios({
      url: `${url}/state/${id}/${state}`,
      method: "put",
      meta: {
        hasProjectId: true,
      },
    });

  const getButtons = (id) =>
    window.$axios({
      url: `${url}/${id}/buttons`,
      method: "get",
      meta: {
        hasProjectId: true,
      },
    });

  const getColumns = (id) =>
    window.$axios({
      url: `${url}/${id}/columns`,
      method: "get",
      meta: {
        hasProjectId: true,
      },
    });

  const getForms = (id) =>
    window.$axios({
      url: `${url}/${id}/forms`,
      method: "get",
      meta: {
        hasProjectId: true,
      },
    });

  const getListProjectId = (params) =>
    window.$axios({
      url: `${url}s`,
      method: "get",
      params,
      meta: {
        hasProjectId: true,
      },
    });

  const removeProjectId = (id) =>
    window.$axios({
      url: `${url}/${id}`,
      method: "delete",
      meta: {
        hasProjectId: true,
      },
    });

  const getProjectId = (id) =>
    window.$axios({
      url: `${url}/${id}`,
      method: "get",
      meta: {
        hasProjectId: true,
      },
    });
  return {
    ...crud,
    updateState,
    getButtons,
    getColumns,
    getForms,
    getListProjectId,
    removeProjectId,
    getProjectId,
  };
};
